@keyframes source-editor-spinner-rotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

[data-editor-loading] {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 0;

  > * {
    filter: blur(5px);
  }

  &::before {
    $size: 32px;
    $border-width: 3px;
    $color: $gray-700;

    content: '';
    @include webkit-prefix(transform-origin, 50% 50% calc((#{$size} / 2) + #{$border-width}));
    width: $size;
    height: $size;
    border-width: $border-width;
    border-color: rgba($color, 0.25);
    border-top-color: $color;
    border-radius: 50%;
    margin: 0 auto;
    animation-name: source-editor-spinner-rotate;
    animation-duration: 0.6s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    border-style: solid;
    display: inline-flex;
    position: absolute;
    z-index: 1;
  }

  pre {
    opacity: 0;
  }
}

[id^='source-editor-'] {
  height: 500px;
}

.source-editor-preview {
  display: flex;

  .md {
    overflow: scroll;
    padding-left: $gl-spacing-scale-6;
    padding-right: $gl-spacing-scale-6;
    padding-top: $gl-spacing-scale-4;
    padding-bottom: $gl-spacing-scale-4;
    width: 100%;
  }

  .gl-source-editor {
    order: -1;
    border-radius: 0 0 $gl-border-radius-base $gl-border-radius-base;
  }
}

.monaco-editor.gl-source-editor {
  // Fix unreadable headings in tooltips for syntax highlighting themes that don't match general theme
  &.vs-dark .markdown-hover {
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      color: $source-editor-hover-light-text-color;
    }
  }

  &.vs .markdown-hover {
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      color: $source-editor-hover-dark-text-color;
    }
  }

  .margin-view-overlays {
    .line-numbers {
      display: flex;
      justify-content: flex-end;
      position: relative;

      &::before {
        visibility: hidden;
        align-self: center;
        background-color: $gray-400;
        margin-right: $gl-spacing-scale-2;
        width: $gl-spacing-scale-4;
        height: $gl-spacing-scale-4;
        mask-image: url('icons-stacked.svg#link');
        mask-repeat: no-repeat;
        mask-size: cover;
        mask-position: center;
        content: '';
      }

      &:hover {
        text-decoration: underline;
        cursor: pointer !important;
      }

      &:hover::before {
        visibility: visible;
      }

      &:focus::before {
        visibility: visible;
        outline: auto;
      }

      .link-anchor {
        display: block;
        position: absolute;
        width: 100%;
        height: 100%;
      }
    }
  }

  // Remove custom focus from element
  .inputarea {
    box-shadow: none;
  }
}

.active-line-text {
  background-color: $orange-600;
  opacity: 0.3;
}
